<?php
/* 
 * Copyright (c) 2018-2021   All rights reserved.
 * 
 * 创建时间：2021-08-28 15:31
 *
 * 项目：rm  -  $  - BasePayIden.php
 *
 * 作者：liwei 
 */

namespace modules\levpays;

use Lev;
use lev\base\Modulesv;

!defined('INLEV') && exit('Access Denied LEV');

abstract class BasePayIden {
    //abstract
    public static function getPayGoodsInfo($uid, $goodsId, $paymoney, $tradeId) {

    }

    //abstract
    public static function setPaySuccess($tradeInfo) {

    }

    /**
     * @param $iden
     * @param $uid
     * @param $goodsId
     * @param $paymoney
     * @param $tradeId
     * @param array $extParam
     * @return array|bool|mixed
     */
    public static function getPayGoodsInfoByIden($iden, $uid, $goodsId, $paymoney, $tradeId, $extParam = []) {
        if ($iden == 'levpays') {
            return payIdenHelper::getPayGoodsInfo($uid, $goodsId, $paymoney, $tradeId, $extParam);
        }
        return Lev::actionObjectMethodIden(
            $iden,
            'modules\\' . Modulesv::getIdenNs($iden) . '\payIdenHelper',
            [$uid, $goodsId, $paymoney, $tradeId, $extParam],
            'getPayGoodsInfo'
        );
    }

    /**
     * @param $tradeInfo
     * @param array $extParam
     * @return array|bool|mixed
     */
    public static function setPaySuccessByIden($tradeInfo, $extParam =[]) {
        $iden = $tradeInfo['iden'];
        if ($iden == 'levpays') {
            return payIdenHelper::setPaySuccess($tradeInfo);
        }
        return Lev::actionObjectMethodIden(
            $iden,
            'modules\\' . Modulesv::getIdenNs($iden) . '\payIdenHelper',
            [$tradeInfo, $extParam],
            'setPaySuccess'
        );
    }
}
